﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using UCL;
using UCL.Forms;

namespace DBKit5
{
    public partial class frmEncrypt : Form
    {
        public frmEncrypt()
        {
            InitializeComponent();
        }

        private void btnEnc_Click(object sender, EventArgs e)
        {
            if (!CheckForm()) return;
            tbResult.Text = EncryptHelper.SOMDA(tbText.Text);
            
        }

        private void btnDeEnc_Click(object sender, EventArgs e)
        {
            if (!CheckForm()) return;
            tbResult.Text = EncryptHelper.SODEMDA(tbText.Text);
        }
        private bool CheckForm()
        {
            FormBinder fb = new FormBinder();
            if (tbText.TextLength == 0) fb.AddMessage("文本无效");
            if (cbType.SelectedIndex == -1) fb.AddMessage("加密类型未选择");
            return fb.IsValidForm();
        }
    }
}
